<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
    <style>
        *{
            margin: 0;
            padding: 0;
            list-style: none;
        }
        .red{
            width: 400px;
            height: 400px;
            position: relative;
            background-color: red;
        }
        .yellow{
            width: 200px;
            height: 200px;
            position: absolute;
            left: 100px;
            top: 100px;
            background-color: yellow;
        }
    </style>
</head>
<body>
    <div id="app">
        数字  <input type="text" v-model.number="num"/>

        <div class="red" @click.once="fn1">
            <div class="yellow" @click.stop="fn2"></div>
        </div>

    </div>
    
</body>
<script>
    new Vue({
        el:"#app",
        data:{
            num:10
        },
        methods:{
            fn1(){
                alert("红色被点击")

            },
            fn2(){
                // e.stopPropagation();
                alert("黄色被点击")
            }
        }
    })

</script>
</html>